﻿//  Author:
//       Daniel Großer <olav.daniel.grosser@googlemail.com>
//  
//  Copyright (c) 2012 Copyright (C) 2012 by Daniel Großer. This Code is under GNU LGPL 3.0
// 
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
// 
//  You should have received a copy of the GNU Lesser General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace Beauty.ErrorHandling
{
    /// <summary>
    /// Get the different types of errors that can be detected during constructing or
    /// using the parser.
    /// </summary>
    public enum ParserErrorType
    {
        /// <summary>
        /// AST has been parsed but scanner did not reach expected end of input.
        /// </summary>
        [Description("AST has been parsed but scanner did not reach expected end of input.")]
        Expected_EOF,
        /// <summary>
        /// A AST node must provide a default constructor.
        /// </summary>
        [Description("{0} must provide a default constructor to be used as an AST node.")]
        MissingConstructor,
        /// <summary>
        /// LL(1) constraint of unique lookout failed.
        /// </summary>
        [Description("AST node {0} is not LL(1), because expected start terminals are not unique, for example {1} (property {2}).")]
        ExpectedTerminalsNotUnique,
        /// <summary>
        /// LL(1) constraint of unique lookout failed for alternation.
        /// </summary>
        [Description("The alternation induced by AST node {0} is not LL(1), because expected start terminals are not unique. The first terminal {1} of {2} is also a first terminal of other possible productions.")]
        AlternationNotUnique,
        /// <summary>
        /// LL(1) constraint failed because left-recursion has been found.
        /// </summary>
        [Description("AST node {0} is not LL(1) because it contains left-recursion.")]
        LeftRecursionDetected,
        /// <summary>
        /// LL(1) constraint failed because some node evaluates to epsilon.
        /// </summary>
        [Description("AST node {0} has no expected start terminals.")]
        NoExpectedTerminals,
        /// <summary>
        /// Language has not been provided completely to the parser.
        /// </summary>
        [Description("AST node {0} does not belong the language passed to the parser.")]
        AST_NotInLanguage,
        /// <summary>
        /// LL(1) constraint failed because some node could evaluate to epsilon.
        /// </summary>
        [Description("AST node {0} is not LL(1). It has only optional parts and could thus evaluate to ɛ.")]
        EpsilonDetected,
        /// <summary>
        /// During parsing, a syntax error has been detected.
        /// </summary>
        [Description("Expected one of [{1}], but found {0}.")]
        SyntaxError
    }
}
